home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / Ebooks / Thinking in C++ V2 / C03 / Forward.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-25  |  494 b   |  23 lines

  1. //: C03:Forward.cpp
  2. // From Thinking in C++, 2nd Edition
  3. // Available at http://www.BruceEckel.com
  4. // (c) Bruce Eckel 1999
  5. // Copyright notice in Copyright.txt
  6. // Forward function & data declarations
  7. #include <iostream>
  8. using namespace std;
  9.  
  10. // This is not actually external, but the 
  11. // compiler must be told it exists somewhere:
  12. extern int i; 
  13. extern void func();
  14. int main() {
  15.   i = 0;
  16.   func();
  17. }
  18. int i; // The data definition
  19. void func() {
  20.   i++;
  21.   cout << i;
  22. } ///:~
  23.